﻿using System;
using System.Net;

namespace HappyBa.Core.Data
{
    class WebClientWithTimeout : WebClient
    {
        private readonly int timeout;

        public WebClientWithTimeout(int timeout)
        {
            this.timeout = timeout*1000;
        }

        protected override WebRequest GetWebRequest(Uri uri)
        {
            var w = base.GetWebRequest(uri);
            w.Timeout = timeout;
            return w;
        }
    }
}
